package pl.edu.agh.agents.gui.actions;

import java.awt.Color;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JColorChooser;

import pl.edu.agh.agents.gui.GUI;

// dumps current configuration to file
public class GetColorAction extends AbstractAction {
	private static final long serialVersionUID = -1940878883959876753L;
	private GUI gui;

	public GetColorAction(String name, GUI gui) {
		super(name);

		this.gui = gui;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		Color color = JColorChooser.showDialog(gui.getGraphComponent(), "Agent color", gui.getAddedAgentColor());

		if (color == null) {
			return;
		}

		System.out.println("You chose color " + color);
		
		gui.setAddedAgentColor(color);
	}
}